using CheckIn.UserInfoHost;
using CheckIn.UserInfoHost.Infrastructures;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace UnitTest
{
    public class UserInfoHostTest
    {
        public UserInfoHostTest()
        {
            Task.Run(() => {
                var builder = new ConfigurationBuilder();
                builder.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
                CheckIn.UserInfoHost.Program.Run(builder.Build());
            });

            while(!Program.Ready)
            {
                Thread.Sleep(100);
            }    
        }

        [Fact]
        public async Task LoginTest()
        {
            var wechatService = CheckIn.UserInfoHost.Global.ServiceProvider.GetService<WechatService>();
            await wechatService.Login("0b149aGa1luaIH09qBJa109YVs149aGF");
        }

      

        [Fact]
        public void test()
        {
            Thread.Sleep(1999999999);
        }
    }
}